package com.gopay.common.order.bankorder.trade;

import org.apache.commons.lang.StringUtils;

public class TradeType {
	
	public static final String TRADE_TYPE_B2B = "B2B";
	public static final String TRADE_TYPE_B2C = "B2C";
	public static final String TRADE_TYPE_MTPAY = "MTPAY";
	public static final String TRADE_TYPE_EXPAY = "EXPAY";
	public static final String TRADE_TYPE_SCAN = "SCAN";
	public static final String TRADE_TYPE_SDK = "SDK";
	public static final String TRADE_TYPE_WCPAY="WCPAY";
	public static final String TRADE_TYPE_MICRO ="MICRO";
	
    /**
     * 获取交易类型
     * 
     * @param payChannel
     *            支付渠道
     * @return
     */
	
	public static String getTradeType(int trandType){
		String tradeType = null;
		switch (trandType) {
		case 1:
			tradeType = TRADE_TYPE_B2B;
			break;
		case 2:
			tradeType = TRADE_TYPE_B2C;
			break;
		case 3:
			tradeType = TRADE_TYPE_MTPAY;
			break;

		default:
			break;
		}

        return tradeType;
	}
    public static String getOrderTrandType(String payChannel) {
        if (StringUtils.equals(payChannel, "00") || StringUtils.equals(payChannel, "01")
                || StringUtils.equals(payChannel, "02")
				|| StringUtils.equals(payChannel, "08")
				|| StringUtils.equals(payChannel, "49")
                || StringUtils.equals(payChannel, "50")) {
            return TRADE_TYPE_B2C;
        }else if(StringUtils.equals(payChannel, "06") ||
                StringUtils.equals(payChannel, "03")  ||
                StringUtils.equals(payChannel, "05")  ||
                StringUtils.equals(payChannel, "15")  ||
                StringUtils.equals(payChannel, "30")  || //add by dongdh 20160517
                StringUtils.equals(payChannel, "31")  ||
                StringUtils.equals(payChannel, "32")  ||
                StringUtils.equals(payChannel, "33")  ||
                StringUtils.equals(payChannel, "34")  ||
				StringUtils.equals(payChannel, "35")  ||
				StringUtils.equals(payChannel, "36")
                ){
        	return TRADE_TYPE_EXPAY;
        }else if(StringUtils.equals(payChannel, "16")){
        	return TRADE_TYPE_SCAN;
        }else if(StringUtils.equals(payChannel, "17")){
        	return TRADE_TYPE_SDK;
        }else if(StringUtils.equals(payChannel, "18") || StringUtils.equals(payChannel, "28")){//添加一码付支付渠道 added by pansc
        	return TRADE_TYPE_WCPAY;
        }else if(StringUtils.equals(payChannel, "25")){
            return TRADE_TYPE_MICRO;
        }

        return TRADE_TYPE_B2B;
    }
}
